package com.lz.sports.bean

import android.os.Parcel
import android.os.Parcelable
import com.lz.library.proguard.IProguardField
import com.google.gson.annotations.Expose

//考场
class ExamRoom() : ParcelableString, IProguardField {

    //唯一值 其它关联表的外键
    @Expose
    var id: Int = 0

    @Expose
    var examSiteId: Int = 0

    @Expose
    var examAreaId: Int = 0

    @Expose
    var examPlanId: Int = 0

    //编号
    @Expose
    var roomCode: String = ""

    //项目名称
    @Expose
    var roomName: String = ""

    @Expose
    var createTime: Long = 0L

    @Expose
    var updateTime: Long = 0L

    constructor(parcel: Parcel) : this() {
        id = parcel.readInt()
        examSiteId = parcel.readInt()
        examAreaId = parcel.readInt()
        examPlanId = parcel.readInt()
        roomCode = parcel.readString()!!
        roomName = parcel.readString()!!
        createTime = parcel.readLong()
        updateTime = parcel.readLong()
    }

    override fun str(): String = roomCode

    override fun equals(other: Any?): Boolean = other === this || (other is ExamRoom && other.id == id)

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeInt(id)
        parcel.writeInt(examSiteId)
        parcel.writeInt(examAreaId)
        parcel.writeInt(examPlanId)
        parcel.writeString(roomCode)
        parcel.writeString(roomName)
        parcel.writeLong(createTime)
        parcel.writeLong(updateTime)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<ExamRoom> {
        override fun createFromParcel(parcel: Parcel): ExamRoom {
            return ExamRoom(parcel)
        }

        override fun newArray(size: Int): Array<ExamRoom?> {
            return arrayOfNulls(size)
        }
    }
}